
const modelAction = {
    query: ['condition'],
    add: ['data'],
    updateById: ['data'],
    updateByIds: ['data'],
    deleteById: ['id'],
    deleteByIds: ['ids'],
}

const modelConfig = {
    Logic: {
        ...modelAction,
        splitByGroupKey: ['model', 'instanceId', 'parentId', 'groupKey', 'data'],
        copy: ['model', 'instanceId', 'parentId', 'data'],
        copyMasterAndHierList: ['model', 'instanceId', 'parentId', 'data'],
    },
    StaticLogic: {
        ...modelAction
    },
    Twins: {
        ...modelAction
    },
    Consume: {
        ...modelAction
    },
    Resource: {
        ...modelAction
    },
    Hier: {
        saveHierWithoutModel: ['data'],
        updateById: ['data'],
        updateBatchById: ['data'],
        updateLimitCount: ['containerId', 'parentId', 'uniqueKey', 'values', 'model', 'className', 'data'],
    },
    Planner: {
        execOutsourcingOrderQuantity: ['id']
    },
    Sale: {
        updateSaleOrderPrice: ['model', 'instanceId', 'parentId']
    },
    Stock: {
        outBound: ['formType', 'formId', 'data'],
        inBound: ['formType', 'formId', 'data'],
        inBoundToWaitCheck: ['formType', 'formId', 'data'],
        inBoundToDefective: ['formType', 'formId', 'data'],
    },
    Business: {
        updateAnotherByCurrent: ['currentModel', 'currentContainerId', 'anotherModel', 'anotherContainerId', 'uniqueFieldPathMap',
             'checkException', 'checkExpression', 'checkFlag', 'updateValueExpression' ],
        createOtherInstanceToContainer: ['containerId', 'className', 'model', 'createInsNodeId', 'enterNodeId', 'name', 'values'],
        addNodeAndLinkInstanceToListContainer: ['model', 'containerId', 'parentNodeId', 'dataArray'],
        updateOtherInstanceByParent: ['model', 'containerId', 'parentNodeId', 'values'],
        queryHierLinkAndGroupBy: [
            'condition', 'hierValueCondition', 'model', 'containerId', 'className',
            'linkModel', 'linkClassName', 'linkType', 'linkCondition', 'groupByKey'
        ],
        deleteNodeByLink: ['model', 'containerId', 'parentNodeId', 'linkDataArray'],
        // 
        createEntityToContainer: ['wcId', 'values'],
        createInstanceToContainer: [
            //工作中心
            'wcClassName', 'wcId', 
            //工作中心关联实例属性值
            'createInsNodeId', 'enterNodeId', 'name', 'values'
        ],
        transferInstanceToContainer: [
            //工作中心
            'wcClassName', 'wcId',
            // 转换节点
            'transferInsNodeId', 'enterNodeId', 'leaveNodeId',
        ],
        dealWorkCenterHierNodeStatus: ['wcNodeId', 'wcId', 'status', ],
        transferInstanceWCToContainer: ['wcClassName', 'wcId', 'transferInsNodeId', 'enterNodeId', 'enterModel', 'enterClassName', 'enterContainerId'],
        updateInstanceByNode: ['wcInstanceId', 'wcNodeId', 'values'],
        updateOccupyStatus: ['wcId', 'wcNodeList', 'occupyStatus'],
        batchTransferInstanceWCToContainer: ['wcClassName', 'wcInstanceId', 'transferInsNodeId', 'enterNodeId', 'enterModel', 'enterClassName', 'enterContainerId']
    },
}
let modelOptions = []
let actionMap = {}
let refsMap = {}

// 将级联结构组织成options
Object.keys(modelConfig).forEach(key => {
    modelOptions.push({label: key, value: key})
    actionMap[key] = []
    Object.keys(modelConfig[key]).forEach(actionKey => {
        actionMap[key].push({label: actionKey, value: actionKey})
        refsMap[`${key}_${actionKey}`] = modelConfig[key][actionKey].map(item => ({name: item}))
    })
})

let res = {
    // modelConfig,
    modelOptions,
    actionMap,
    refsMap,
}
// console.log("file: config.js:25  res:", res)
export default res
